package cc.realxyq.demo.config;

import cc.realxyq.demo.bean.RealxyqDocument;
import cc.realxyq.demo.condition.LinuxCondition;
import cc.realxyq.demo.condition.MacCondition;
import cc.realxyq.demo.condition.WindowsCondition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

/**
 * 关于condition的配置类
 * @author kwhan
 * @date 2022年01月07日 17:09
 */
@Configuration
public class ConditionalConfig {

    @Conditional(WindowsCondition.class)
    @Bean("windows")
    public RealxyqDocument windowsDocument(){
        return new RealxyqDocument();
    }

    @Conditional(LinuxCondition.class)
    @Bean("linux")
    public RealxyqDocument linuxDocument(){
        return new RealxyqDocument();
    }

    @Conditional(MacCondition.class)
    @Bean("mac")
    public RealxyqDocument macDocument(){
        return new RealxyqDocument();
    }


}
